#!/bin/sh
#rem Param 1: System User
#rem Param 2: System Passwort
#rem Param 3: Connection key in tnsnames.ora
#rem Param 4: oms user
#rem Parma 5: oms password

system_user=$1
system_pass=$2
connection=$3
oms_user=$4
oms_pass=$5 

if [ -z "$system_user" ]; then
    error="err" 
fi

if [ -z "$system_pass" ]; then 
    error="err" 
fi

if [ -z "$connection" ]; then 
    error="err" 
fi

if [ -z "$oms_user" ]; then
    error="err" 
fi

if [ -z "$oms_pass" ]; then 
    error="err" 
fi

if [ -n "$error" ]; then
    echo 'Missing parameter!'
    echo 'Syntax:'
    echo 'omssetup [system user] [system passwort] [tnsnames.ora connection key] [new oms user] [new oms passwort]'
else
    sqlplus ${system_user}/${system_pass}@${connection} @setup/start.sql $connection $oms_user $oms_pass 
fi
